﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Web.UI;
using System.Text;
using Marbles.Core.Content.Pages;

namespace Marbles.Core.Controls
{
    [ToolboxData("<{0}:SocialNetworkShare runat=server></{0}:SocialNetworkShare>")]
    public class SocialNetworkShare : WebControl
    {

        protected override void Render(HtmlTextWriter writer)
        {
            Marbles.Core.Pages.Page p = this.Page as Marbles.Core.Pages.Page;
            PageDefinition def = p.CurrentPage;

            writer.Write("<div class=\"a2a_kit a2a_default_style\">");
            writer.Write("<a class=\"a2a_dd\" href=\"http://www.addtoany.com/share_save?linkurl=" + def.Link + "&amp;linkname=" + def.Title + "\">Share</a>");
            writer.Write("<span class=\"a2a_divider\"></span>");
            writer.Write("<a class=\"a2a_button_facebook\"></a>");
            writer.Write("<a class=\"a2a_button_twitter\"></a>");
            writer.Write("<a class=\"a2a_button_email\"></a>");
            writer.Write("<a class=\"a2a_button_bebo\"></a>");
            writer.Write("<a class=\"a2a_button_blogger_post\"></a>");
            writer.Write("<a class=\"a2a_button_myspace\"></a>");
            writer.Write("<a class=\"a2a_button_linkedin\"></a>");
            writer.Write("<a class=\"a2a_button_digg\"></a>");
            writer.Write("</div>");
            writer.Write("<script type=\"text/javascript\">");
            writer.Write("var a2a_config = a2a_config || {};");
            writer.Write("a2a_config.linkname = \"" + def.Title + "\";");
            writer.Write("a2a_config.linkurl = \"" + def.Link + "\";");
            writer.Write("</script>");
            writer.Write("<script type=\"text/javascript\" src=\"http://static.addtoany.com/menu/page.js\"></script>");
        }
    }
}
